/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SPARQL.Utilities;

import Rewriting.VariableNameGenerator;
import SPARQL.SPARQL;
import SPARQL.Variable;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author dimartinomirko
 */
public class QueryRenamer extends SPARQLVariableRenamer{
    
    private SPARQL query;
    
    public QueryRenamer(SPARQL query){
    super();
    this.query = (SPARQL)  query.clone();
    
    }
    
   
    
    public void renameVariables(){
        
        
        VariableNameGenerator generator = VariableNameGenerator.getInstance();
        
        
        renameSetTriples(query.getTriplePatterns());
        renameListTerms(query.getSelectVariables());
        renameBindings(query.getBindings());
      
        
        }
    
    public void renameVariables(Map<Variable, Variable> map){
        
        
        this.varsMap = map;
        
        
        renameVariables();
      
        
        }
    
    public SPARQL getQuery() {
        return this.query;
        
    }
}
